package com.zuihai.app.mvp.ui.activity.find.newfind;

import android.os.Bundle;
import android.view.View;

import com.blankj.utilcode.util.LogUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.zuihai.app.mvp.constant.DetailConstant;
import com.zuihai.app.mvp.constant.ReleaseConstant;
import com.zuihai.app.mvp.model.entity.HomeItem;
import com.zuihai.app.mvp.ui.activity.detail.DetailContainerActivity;
import com.zuihai.app.mvp.ui.activity.home.HomeRecyclerFragment;

import java.util.Calendar;

/**
 * Created by Zc on 2017/5/9.
 * 发现-推荐
 */

public class NewFindRecommendFragment extends HomeRecyclerFragment {

    public static NewFindRecommendFragment newInstance() {
        Bundle args = new Bundle();
        NewFindRecommendFragment fragment = new NewFindRecommendFragment();
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    protected void requestData(boolean isRefresh) {
        mPresenter.requestFindRecomment(isRefresh);
        /*if (isRefresh==true){
            mPresenter.requestFindRecomment(true);
        }else {
            mPresenter.requestFindRecomment(false);
        }*/
    }
    @Override
    public void onPause() {
        super.onPause();
        LogUtils.e("onPause FindRecommendFragment");

    }

    @Override
    public void onStop() {
        super.onStop();
        LogUtils.e("onStop FindRecommendFragment");
    }

    @Override
    public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
        long currentTime = Calendar.getInstance().getTimeInMillis();
        if (currentTime - lastClickTime > MIN_CLICK_DELAY_TIME) {
            lastClickTime = currentTime;
            HomeItem item = (HomeItem) adapter.getItem(position);
            String detailId = item.id;
            int mubantag=item.itemType;
            if (mubantag==4){

            }
            DetailContainerActivity.launchActivity(getContext(),
                    DetailConstant.HEADLINE_TYPE, ReleaseConstant.RELEASE_HEADLINE+"", detailId);
        }
    }
}
